package edu.tju.moralManage;

import java.sql.SQLException;
import java.util.List;

import com.ibatis.sqlmap.client.SqlMapClient;
import com.younker.waf.db.IBatisConfig;

public class IbatisAppraiseRuleDao implements IAppraiseRuleDao {
	protected SqlMapClient sqlMap = IBatisConfig.getSqlMapInstance();


	public List<AppraiseRule> getAppraiseRuleAnd(AppraiseRule appraiseRule)
			throws SQLException {
		
		return sqlMap.queryForList("getAppraiseRuleAnd", appraiseRule);
	}

	public AppraiseRule getAppraiseRuleById(long id) throws SQLException {
		
		return (AppraiseRule) sqlMap.queryForObject("getAppraiseRuleById", id);
	}

	public List<AppraiseRule> getAppraiseRuleOr(AppraiseRule appraiseRule)
			throws SQLException {
		// TODO Auto-generated method stub
		return null;
	}

	public Long insertAppraiseRule(AppraiseRule appraiseRule)
			throws SQLException {
		
		return (Long)sqlMap.insert("insertAppraiseRule", appraiseRule);
	}

	public int updateAppraiseRule(AppraiseRule appraiseRule)
			throws SQLException {
		
		return sqlMap.update("updateAppraiseRule", appraiseRule);
	}

	public void deleteAppraiseRule(long id) throws SQLException {
		
		sqlMap.delete("deleteAppraiseRule", id);
	}

}
